using SqlSugar;
using System;

namespace twistmachinev2.Entity
{
    /// <summary>
    /// 示例实体类 - 演示如何使用SqlSugar特性
    /// </summary>
    [SugarTable("sample_data")]
    public class SampleEntity
    {
        /// <summary>
        /// 主键ID，自增
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 名称，必填字段
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 100)]
        public string Name { get; set; }

        /// <summary>
        /// 描述，可选字段
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 500)]
        public string Description { get; set; }

        /// <summary>
        /// 数值
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public decimal Value { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public bool IsActive { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间，可为空
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? UpdateTime { get; set; }
    }

    /// <summary>
    /// 日志实体类
    /// </summary>
    [SugarTable("system_logs")]
    public class SystemLog
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(IsNullable = false, Length = 50)]
        public string Level { get; set; }

        [SugarColumn(IsNullable = false, Length = 200)]
        public string Message { get; set; }

        [SugarColumn(IsNullable = true, ColumnDataType = "TEXT")]
        public string Details { get; set; }

        [SugarColumn(IsNullable = false)]
        public DateTime LogTime { get; set; }

        [SugarColumn(IsNullable = true, Length = 100)]
        public string Source { get; set; }
    }

    /// <summary>
    /// 设备数据实体类
    /// </summary>
    [SugarTable("device_data")]
    public class DeviceData
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(IsNullable = false, Length = 50)]
        public string DeviceId { get; set; }

        [SugarColumn(IsNullable = false, Length = 100)]
        public string DeviceName { get; set; }

        [SugarColumn(IsNullable = false, Length = 50)]
        public string ParameterName { get; set; }

        [SugarColumn(IsNullable = false, Length = 100)]
        public string ParameterValue { get; set; }

        [SugarColumn(IsNullable = true, Length = 20)]
        public string Unit { get; set; }

        [SugarColumn(IsNullable = false)]
        public DateTime CollectTime { get; set; }

        [SugarColumn(IsNullable = true)]
        public double? NumericValue { get; set; }
    }
}